package org.example.day20240828;

import java.util.*;

public class RecycleMain {

    static class Point{
        Integer x;
        Integer y;

        public Point(Integer x, Integer y) {
            this.x = x;
            this.y = y;
        }

        public int count(Point point){
            if(point.x == this.x+1 && point.y == this.y+1 || point.x == this.x-1 && point.y == this.y-1 ||
                point.x == this.x-1 && point.y == this.y+1 || point.x == this.x+1 && point.y == this.y-1
            ){
                return 1;
            }else {
                return 0;
            }
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (!(o instanceof Point)) return false;
            Point point = (Point) o;
            return Objects.equals(getX(), point.getX()) && Objects.equals(getY(), point.getY());
        }

        @Override
        public int hashCode() {
            return Objects.hash(getX(), getY());
        }

        public Integer getX() {
            return x;
        }

        public void setX(Integer x) {
            this.x = x;
        }

        public Integer getY() {
            return y;
        }

        public void setY(Integer y) {
            this.y = y;
        }
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int num1 = scanner.nextInt();
        Set<Point> pointSet = new HashSet<>();
        for(int i=0; i<num1; i++){
            int numX = scanner.nextInt();
            int numY = scanner.nextInt();
            pointSet.add(new Point(numX,numY));
        }
        Set<Point> recyclePoint = new HashSet<>();
        for (Point point : pointSet){
            if(pointSet.contains(new Point(point.getX()-1, point.getY())) &&
               pointSet.contains(new Point(point.getX()+1, point.getY())) &&
               pointSet.contains(new Point(point.getY()-1, point.getX())) &&
               pointSet.contains(new Point(point.getY()+1, point.getX()))
            ){
                recyclePoint.add(point);
            }
        }
        Map<Integer,Integer> resultMap = new HashMap<>();
        int i = 0;
        for (Point point: recyclePoint){
            int count = 0;
            for (Point point1 : pointSet){
                count += point.count(point1);
            }
            resultMap.put(count,1);
            }
        for (int j=0; j<resultMap.size(); j++){
            System.out.println(resultMap.get(j));
        }

    }
}
